package com.cysyz.mylib.utils;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;

/**
 * @author Jack 图片工具
 */
public class ImageUtil {

	/**
	 * 判断文件是否是图片
	 */
	public File judgepic(File o) {
		try {
			ImageInputStream iis = ImageIO.createImageInputStream(o);
			Iterator iter = ImageIO.getImageReaders(iis);
			if (!iter.hasNext()) {
				return null;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return o;
	}
}
